// #packager-optimize

(function() {

    var $u = juliet.using({ object : 'juliet.core.object-0.1' });

    /**
     * Used to proxy dragging element.
     */
    var DragProxy = function() {

        /**
         * Proxy dom element.
         */
        this.domElement = null;

        /**
         * Options object passed on "initialize" method with default values for unset parameters.
         */
        this.options = {
            proxyDx : 10,
            proxyDy : 10
        };

        /**
         * Shows the proxy element.
         */
        this.show = function() {
            this.domElement.style.display = 'block';
        };

        /**
         * Hides the proxy element.
         */
        this.hide = function() {
            this.domElement.style.display = 'none';
        };

        /**
         * Sets the proxy element size equals to passed parameters.
         */
        this.setSize = function(width, height) {
            this.domElement.style.width = width + 'px';
            this.domElement.style.height = height + 'px';
        };

        /**
         * Sets the proxy element offset equals to passed parameters.
         */
        this.setOffset = function(left, top) {
            this.domElement.style.left = left + this.options.proxyDx + 'px';
            this.domElement.style.top = top + this.options.proxyDy + 'px';
        };

        /**
         * Creates proxy dom element.
         */
        this.createDomElement = function() {
            this.domElement = document.createElement('div');
            this.domElement.className = 'drag-proxy';

            document.body.appendChild(this.domElement);
        };

        /**
         * Initialize instance using options.
         */
        this.initialize = function(o) {
            $u('object').merge(this.options, o);

            this.createDomElement();
        };

    };

    juliet.registerModule('juliet.ui.dragAndDrop', 'DragProxy-0.1', DragProxy);

})();
